home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
Machine.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
740b
|
38 lines
#include "stdafx.h"
cMachine::cMachine(int _x, int _y, cProperties *_orig)
: cWeapon(_x, _y, _orig, "MOVING")
{
not_spitting = 2 * sec + rnd(4 * sec);
ASSERT(!machine_contents_list.is_empty());
ASSERT(orig->spot != 0);
}
cMachine::~cMachine()
{
}
int cMachine::control()
{
cWeapon::control();
// Spit?
if (!not_spitting)
{
int rx = pmrnd(32), ry = rnd(32);
cRolling *r = new cRolling (x + rx + orig->spot->x, y + ry - orig->spot->y, machine_contents_list.get_random());
r->add_angular_speed(100, angle(rx, ry));
new cEffect (x + rx, y + ry, orig, "SPIT");
not_spitting = 2 * sec + rnd(4 * sec);
}
// Check if still on screen
return !below_screen();
}